﻿using System;
using System.Xml.Serialization;

namespace AOUtils.Libraries
{
    public class OptimizedRequirement
    {
        public OptimizedRequirement()
        {
        }
        public OptimizedRequirement(Requirement req)
        {
        }
        public static implicit operator OptimizedRequirement(Requirement req)
        {
            OptimizedRequirement oreq = new OptimizedRequirement();
            oreq.Target = req.Target;
            oreq.Statistic = req.Statistic;
            oreq.Operator = (OperatorType)Enum.Parse(typeof(OperatorType), req.Operator.Replace(" ", ""));
            oreq.Value = req.Value;
            oreq.ChildOp = req.ChildOp;
            return oreq;
        }
        [XmlAttribute("target")]
        public TargetType Target
        {
            get;
            set;
        }
        [XmlAttribute("statistic")]
        public string Statistic
        {
            get;
            set;
        }
        [XmlAttribute("operator")]
        public OperatorType Operator
        {
            get;
            set;
        }
        [XmlAttribute("value")]
        public string Value
        {
            get;
            set;
        }
        [XmlAttribute("childop")]
        public string ChildOp
        {
            get;
            set;
        }
    }
}
